package com.example.druid.demo_druid.service;

import com.example.druid.demo_druid.interceptor.DataSource;
import com.example.druid.demo_druid.mapper.StudentMapper;
import com.example.druid.demo_druid.model.Student;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author devsun
 *         Created by on 2017/12/10.
 */
@Service
public class StudentService {

    @Autowired
    private StudentMapper studentDao;

    @DataSource
    public List<Map<String,Object>> getList(){
        PageHelper.startPage(1,5,true);
        List<Student> studentList = studentDao.selectAll();
        PageInfo<Student> studentPageInfo = new PageInfo<>(studentList);
        studentDao.insertStudent();
        return studentDao.findStudentList();
    }
}
